<?php

declare(strict_types=1);

namespace App\Model\PssModel;

use App\Model\BaseModel\BasePssModel;
use App\Service\OrderService\OrderRefundService\OrderRefundMessage;

class OrderRefund extends BasePssModel
{
    public $table = 'order_refund';

    //售后审核付款方式
    public $refund_source = [
        OrderRefundMessage::refund_source_cloud     => '云仓审核退款单',
        OrderRefundMessage::refund_source_channel   => 'BBC审核退款单'
    ];
    
    //退款单审核付款方式
    public $refund_amount_type = [
        '1'     => '线上付款',
        '2'     => '线下付款'
    ];
    
    //退款类型
    public $refund_mode = [
        OrderRefundMessage::refund_mode_merchant    => '商家主动退款',
        OrderRefundMessage::refund_mode_user        => '买家申请'
    ];
    
    //仓库方确认审核是否通过退换货（1-确认通过，2-不通过）
    public $warehouse_change_status = [
        '0'    => '待确认',
        '1'    => '确认通过',
        '2'    => '不通过'
    ];
    
    //售后方式
    public $refund_type = [
        OrderRefundMessage::refund_type_goodsandmoney               => '退货退款',
        OrderRefundMessage::refund_type_refundnotgoodsbutmoney      => '仅退款',
        OrderRefundMessage::refund_type_refundchangegoods           => '换货申请',
        OrderRefundMessage::refund_type_refundsendgoods             => '补寄',
    ];
    
    //售后状态
    public $refund_status = [
        '1'     => '待审核',
        '2'     => '同意退款，退款中',
        '3'     => '拒绝申请，售后关闭',
        '4'     => '退款成功',
        '5'     => '已同意退货退款,待用户发货',
        '6'     => '退货退款，待平台处理',
        '7'     => '已同意换货申请，待用户发货',
        '8'     => '拒绝换货申请，售后关闭',
        '9'     => '买家已退货，待确认收货',
        '10'    => '拒绝收货，售后关闭',
        '11'    => '已发货，待买家收货',
        '12'    => '售后成功',
        '13'    => '退款失败',
        '14'    => '已同意补寄货物'
    ];
    
    //申请原因方式
    public $refund_reason_way = [
        '1'     => '主动退款',
        '2'     => '7天无理由',
        '3'     => '拍错/多拍/不喜欢',
        '4'     => '未收到商品',
        '5'     => '协商一致退款',
        '6'     => '商品描述不符',
        '7'     => '商家发错商品',
        '8'     => '大小/颜色/型号不合适',
        '9'     => '质量问题',
        '10'     => '信息填错',
        '11'     => '三方退款',
    ];
    
    /**
     * 获取售后订单数据
     * @param int $bid
     * @param string $order_refund_sn
     */
    public function getRefundOrder(int $bid,string $order_refund_sn)
    {
        return $this->rows([
            'bid'       => $bid,
            'refund_sn' => $order_refund_sn
        ]);
    }
}
